import type { NextPage } from 'next'
import type { ReactElement, ReactNode } from 'react'
import styles from './index.module.scss'
import Layout2 from '@/components/Layout2'
import { useRouter } from 'next/router'
//import { useSession, getSession } from 'next-auth/react'

type NextPageWithLayout = NextPage & {
  getLayout?: (page: ReactElement) => ReactNode
}

const Page: NextPageWithLayout = () => {
  const router = useRouter()
  const sendLogin = () => {
    const userId = (Math.random() + '').slice(2);
    sessionStorage.setItem('userId', userId);
    console.log('userId', userId);
    //signIn();
    router.push('/')
  };
  return (
    <div className={styles.container}>
      <button onClick={sendLogin}>发起登录</button>
    </div>
  )
}

Page.getLayout = function getLayout(page) {
  return (
    <Layout2>
      {page}
    </Layout2>
  )
}

export default Page